package com.hua.giftool.net.api

/**
 * A sealed class to represent the result of an API call.
 */
sealed class ApiResult<out T> {
    /**
     * Represents a successful API call.
     * @param data The data returned by the API.
     */
    data class Success<out T>(val data: T) : ApiResult<T>()

    /**
     * Represents an error response from the API (e.g., HTTP 4xx or 5xx).
     * @param code The HTTP status code.
     * @param message The error message from the server.
     */
    data class Error(val code: Int, val message: String?) : ApiResult<Nothing>()

    /**
     * Represents a network or other unexpected exception during the API call.
     * @param throwable The exception that was thrown.
     */
    data class Exception(val throwable: Throwable) : ApiResult<Nothing>()
}
